home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Magazine / Online / OpenURL / Developer / Source / SmartReadArgs.h < prev   
C/C++ Source or Header  |  1999-09-26  |  3KB  |  97 lines

  1. #ifndef SMARTREADARGS_H
  2. #define SMARTREADARGS_H
  3. /*
  4.  * SmartReadArgs.h -- CLI/Workbench transparent ReadArgs()
  5.  *
  6.  * $VER: SmartReadArgs.h 1.3 (2.9.98)
  7.  *
  8.  * Copyright 1998 by Thomas Aglassinger <agi@sbox.tu-graz.ac.at>
  9.  *
  10.  * Based on ExtReadArgs Copyright 1994,1995 by Stefan Ruppert
  11.  */
  12.  
  13. #ifndef EXEC_TYPES_H
  14. #include <exec/types.h>
  15. #endif
  16.  
  17. #ifndef DOS_RDARGS_H
  18. #include <dos/rdargs.h>
  19. #endif
  20.  
  21. #ifndef DOS_DOS_H
  22. #include <dos/dos.h>
  23. #endif
  24.  
  25. #ifndef WORKBENCH_STARTUP_H
  26. #include <workbench/startup.h>
  27. #endif
  28.  
  29. struct SmartArgs
  30. {
  31.    /* Readargs template */
  32.    STRPTR sa_Template;        
  33.  
  34.    /* Pointer to the parameter array */
  35.    LONG *sa_Parameter;        
  36.  
  37.    /* Specifies which parameter should contain the files passed with the
  38.     * WBStartup message; use -1 for none */
  39.    LONG sa_FileParameter;     
  40.  
  41.    /* Window description to open, if this is started from workbench or NULL
  42.     * for no window. If a WINDOW tooltype is specifies in the icon, it is
  43.     * used instead. */
  44.    STRPTR sa_Window;          
  45.  
  46.    /* Use this RDArgs structure instead of allocating a new. This can be
  47.     * used to specify extended help. */
  48.    struct RDArgs *sa_RDArgs;  
  49.  
  50.    /* Some flags, see below for possible values */
  51.    ULONG sa_Flags;            
  52.  
  53.    /* Pointer to the RDArgs structure returned from the ReadArgs() call */
  54.    struct RDArgs *sa_FreeArgs;
  55.  
  56.    /* Pointer to a buffer to use for the WBStartup. If this is NULL, a
  57.     * buffer is allocated automatically. */
  58.    STRPTR sa_Buffer;
  59.  
  60.    /* Size of the above buffer. If buffer == NULL, this size is used to
  61.     * allocate the buffer. */
  62.    ULONG sa_BufferSize;
  63.  
  64.    /* The fields below are for internal use by SmartReadArgs() only */
  65.  
  66.    STRPTR sa_ActualPtr;       /* Current write location in sa_Buffer */
  67.    STRPTR sa_EndPtr;          /* Pointer to the end of sa_Buffer */
  68.    BPTR sa_WindowFH;          /* Window filehandle, MUST BE NULL */
  69.    BPTR sa_OldOutput;         /* Old output filehandle MUST BE NULL */
  70.    BPTR sa_OldInput;          /* Old input filehandle MUST BE NULL */
  71.    struct WBArg *sa_WBArg;    /* wbargs for erda_FileParameter */
  72.    LONG sa_NumArgs;           /* number of wbargs */
  73. };
  74.  
  75. #define SA_MINIMUM_BUFFER_SIZE        1024
  76.  
  77. /* Flags to be used with SmartArgs.sa_Flags */
  78.  
  79. /* Indicate, that the program was started from Workbench */
  80. #define SAF_WORKBENCH    (1<<0)   
  81.  
  82. /* SmartArgs.sa_RDArgs is allocated by AllocDosObject() */
  83. #define SAF_ALLOCRDARGS  (1<<1)   
  84.  
  85. /* SmartArgs.sa_Buffer is allocated by SmartReadArgs() */
  86. #define SAF_ALLOCBUFFER  (1<<2)
  87.  
  88. /* SmartArgs.sa_Window is allocated by SmartReadArgs() */
  89. #define SAF_ALLOCWINDOW  (1<<3)
  90.  
  91. /* ------------------------------ prototypes ------------------------------ */
  92.  
  93. LONG SmartReadArgs(struct WBStartup *wb_startup, struct SmartArgs * smart_args);
  94. void SmartFreeArgs(struct SmartArgs *smart_args);
  95.  
  96. #endif /* !SMARTREADARGS_H */
  97.